<?php
    require("./Utils.php");

    $post = getJsonParamter();

    $name = $post['name'];
    $type_id = $post['type_id'];
    $kind_id = $post['kind_id'];
    $intro = $post['intro'];
    $price = $post['price'];
    $image = $post['image'];
    $stock = $post['stock'];
    $added = $post['added'];

    $conn = getConnection();
    $sql = "INSERT INTO
            pet(name, type_id, kind_id, intro, price, image, stock)
            VALUES(?, ?, ?, ?, ?, ?, ?)";

    $result = execute($conn, $sql, $name, $type_id, $kind_id, $intro, $price, $image, $stock);

    if($result){
        getJson(200, '添加成功', null);
    }else{
        getJson(500, '添加失败', null);
    }
?>